package com.yygo.jobs;

import com.yygo.model.Bank;
import com.yygo.model.SettlementTask;
import com.yygo.service.BankManager;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by huanli on 2015/11/28.
 */
public class SettlementTaskFactory implements Job{
        @Autowired
        private BankManager bankManager;

        @Override
        public void execute(JobExecutionContext context)
                throws JobExecutionException {
            try {
                System.out.println("任务运行...");
                SettlementTask task = (SettlementTask) context.getMergedJobDataMap().get(
                        "scheduleJob");
                Bank bank = bankManager.get(task.getBank().getId());
                System.out.println("任务名称: [" + task.getId() + "]");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
}
